const mongoose = require('mongoose')//mongoose

const { Schema, model } = mongoose

//user模型
const userSchema = new Schema({
    __v: {
        type: Number,
        select: false,
    },
    name: { // 用户昵称
        type: String,
        default: '新用户'
    },
    username: { // 用户名
        type: String,
        required: true
    },
    password: { // 用户密码
        type: String,
        required: true,
        select: false
    },
    avatar: { // 用户头像
        type: String,
        default: '',
        select: false
    },
    auth: { // 用户类型 
        type: String,
        default: '0',
        select: false
    }
}, {timestamps: true})

module.exports = model('User', userSchema)